<template>
  <div id="app">
    <router-view v-slot="{ Component }">
      <keep-alive v-if="shouldKeepAlive">
        <component :is="Component" />
      </keep-alive>
      <component v-else :is="Component" />
    </router-view>
  </div>
</template>

<script setup>
import { computed } from 'vue';
import { useRoute } from 'vue-router';

const route = useRoute();
const shouldKeepAlive = computed(() => {
  return route.meta && route.meta.keepAlive === true;
});
</script>

<style scoped>
button {
  margin: 0 5px;
}
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: Raleway, sans-serif;
}
</style>